package com.whz.serial;

import lombok.extern.slf4j.Slf4j;

import java.io.*;

/**
 * @ClassName ElvisMainTest
 * @Description TODO
 * @Author hong-zhi
 * @Date 2021/5/27 9:54
 * @Version 1.0
 */
@Slf4j
public class ElvisMainTest {

    public static void main(String[] args) throws IOException {
        String filePath = "d://elvis.txt";
        try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filePath));
             ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filePath))) {
            ElvisEnum elvis = ElvisEnum.INSTANCE;
            log.info("elvis.hashCode(): {}", elvis.hashCode());
            elvis.printFavorites();
            oos.writeObject(elvis);
            Object elvis1 = ois.readObject();
            log.info("elvis1.hashCode(): {}", elvis1.hashCode());
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
